package org.example.springaop;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;

@Slf4j
public class SpringAspectRunner implements CommandLineRunner {

    @Autowired
    private MyService myService;

    @Override
    public void run(String... args) {

        log.info("myService: {}", myService);
        log.info("myService.test: {}", myService.test("bob"));
        try {
            log.info("myService.test: {}", myService.test("xx"));
        } catch (Exception e) {
            log.error("failed. {}", e.getMessage());
        }

        myService.testFoo();
        myService.testBar();
    }
}
